/*
* Copyright (c) 2025 -present FengJinjian ( 751965763@qq.com )
*/
import { request } from "@/utils/request/index";
import type {ListResult} from "@/api/model/listModel";
/**
 * 合同表 接口
 */
export interface ContractInfo {
            index?: number;
            no?: string;
            name?: string;
            status?: any;
            paymentType?: any;
            contractType?: any;
            amount?: any;
            adminName?: string;
            createTime?: any;
            updateTime?: any;
            deleted?: boolean;
}

/**
 * 分页查询参数
 */
export interface ContractPageParams extends BasicPageParams {
  // Add custom search parameters here
}

/**
 * 分页查询结果
 */
export interface ContractPageResult extends BasicFetchResult<ContractInfo> {
  // Add custom result fields here  
}

enum ContractApi {
  List = '/contract/list',
  Create = '/contract/create',
  Update = '/contract/update',
  Delete = '/contract/delete',
  Detail = '/contract/detail',
}

/**
 * 获取合同表列表
 */
export const getContractList = (params: ContractPageParams) => {
  return request.get<ContractPageResult>({
    url: ContractApi.List,
    params,
  });
};

/**
 * 创建合同表
 */
export const createContract = (params: ContractInfo) => {
  return request.post({
    url: ContractApi.Create,
    params,
  });
};

/**
 * 更新合同表
 */
export const updateContract = (params: ContractInfo) => {
  return request.put({
    url: ContractApi.Update,
    params,
  });
};

/**
 * 删除合同表
 */
export const deleteContract = (id: number) => {
  return request.delete({
    url: ContractApi.Delete,
    params: { id },
  });
};

/**
 * 获取合同表详情
 */
export const getContractDetail = (id: number) => {
  return   request.get<ContractInfo>({
    url: ContractApi.Detail,
    params: { id },
  });
};